package com.inspur.edp.metadata.rtcustomization.api.entity;
import com.inspur.edp.lcm.metadata.api.entity.MetadataPackage;
import com.inspur.edp.metadata.rtcustomization.api.entity.GspMdRtContent;
import com.inspur.edp.metadata.rtcustomization.api.entity.GspMdpkg;
import lombok.Data;

import java.util.List;
import java.util.Map;
/**
 * 元数据包解析结果
 */
@Data
public class MetadataPackageParseResult {
    private Map<String, String> fileContentMap;
    private MetadataPackage metadataPackage;
    private GspMdpkg gspMdpkg;
    private List<GspMdRtContent> rtContentList;

    public MetadataPackageParseResult() {
    }

    public MetadataPackageParseResult(Map<String, String> fileContentMap,
                                      MetadataPackage metadataPackage,
                                      GspMdpkg gspMdpkg,
                                      java.util.List<GspMdRtContent> rtContentList) {
        this.fileContentMap = fileContentMap;
        this.metadataPackage = metadataPackage;
        this.gspMdpkg = gspMdpkg;
        this.rtContentList = rtContentList;
    }


    /**
     * 检查解析结果是否有效
     */
    public boolean isValid() {
        return metadataPackage != null &&
                gspMdpkg != null;
    }

    /**
     * 获取元数据ID列表
     */
    public List<String> getMetadataIds() {
        if (rtContentList == null) {
            return new java.util.ArrayList<>();
        }
        return rtContentList.stream()
                .map(GspMdRtContent::getMetadataId)
                .collect(java.util.stream.Collectors.toList());
    }
}
